package com.zsule.frameworks.mongodb.service;

import java.util.List;

import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

import com.zsule.entity.MongoEntity;
import com.zsule.entity.PageEntity;
import com.zsule.frameworks.mongodb.dao.MongoDao;

public interface IMongoService<T extends MongoEntity> {
	public MongoDao<T> getDao();

	public T findAndRemoveFirst(Query query);

	public List<T> findAndRemoveAll(Criteria criteria);

	public List<T> findAndRemoveAll(Query query);

	public List<T> findAll(Class<T> entityClass);

	public long total(Class<T> entityClass);

	public long size(Query query);

	public long size(Criteria criteria);

	public List<T> findList(Criteria criteria);

	public List<T> findList(Query query);

	public List<T> limitFind(int pageSize, int forward);

	public List<T> limitFind(Query query, PageEntity page);

	public List<T> limitFind(int pageSize, int forward, Query query);

	public T findOne(Query query);

	public T findOne(Criteria criteria);

	public T findById(String id);

	public void remove(T entity);

	public void removeById(String id);

	public void save(T entity);

	public void insert(T entity);

	public void insertBatch(List<T> entitys);

	public void updateFirst(Query query, Update update);

	public void updateAll(Query query, Update update);

	public void updateFirst(Criteria criteria, Update update);

	public void updateAll(Criteria criteria, Update update);

	public T findAndModify(Query query, Update update);

	public void updateFirst(String whereKey, Object whereValue, String updateKey, Object updateValue);

	public void updateAll(String whereKey, Object whereValue, String updateKey, Object updateValue);
}
